<mat-form-field class="omv-flex-1"
                [formGroup]="formGroup">
  <div *ngIf="config.icon"
       matPrefix>
    <mat-icon [svgIcon]="config.icon"></mat-icon>&nbsp;
  </div>
  <mat-label>{{ config.label | transloco }}</mat-label>
  <input #passwordInput
         matInput
         type="password"
         autocorrect="off"
         [autocomplete]="config.autocomplete"
         [autocapitalize]="config.autocapitalize"
         [formControlName]="config.name"
         [placeholder]="config.placeholder | transloco"
         [readonly]="config.readonly"
         [autofocus]="config.autofocus"
         [required]="config.validators?.required"
         [minlength]="config.validators?.minLength"
         [maxlength]="config.validators?.maxLength">
  <mat-icon matSuffix
            matTooltip="{{ passwordInput.type === 'password' ? 'Show' : 'Hide' | transloco }}"
            (click)="passwordInput.type = passwordInput.type === 'password' ? 'text' : 'password'"
            svgIcon="mdi:eye-outline">
  </mat-icon>
  <mat-icon *ngIf="config.hasCopyToClipboardButton"
            matSuffix
            matTooltip="{{ 'Copy to clipboard' | transloco }}"
            (click)="onCopyToClipboard()"
            svgIcon="{{ icon.copy }}">
  </mat-icon>
  <mat-error *ngIf="formGroup.invalid">
    <span *ngIf="formGroup.hasError('required', config.name)">
      {{ 'This field is required.' | transloco }}
    </span>
    <span *ngIf="formGroup.hasError('minlength', config.name)"
          transloco="The value must be at least {{ config.validators.minLength }} characters long.">
    </span>
    <span *ngIf="formGroup.hasError('maxlength', config.name)"
          transloco="The value cannot exceed {{ config.validators.maxLength }} characters.">
    </span>
    <span *ngIf="formGroup.hasError('constraint', config.name)">
      {{ formGroup.getError('constraint', config.name) | transloco }}
    </span>
  </mat-error>
  <mat-hint *ngIf="config.hint?.length > 0"
            [innerHTML]="config.hint | transloco | sanitizeHtml">
  </mat-hint>
</mat-form-field>
